﻿@using mscook.mvc;
@model mscook.mvc.Models.BulletinModel
@{
    ViewBag.Title = "封面人物";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section JavaScript
{
    <script src="BootStrap/js/jquery-ui.min.js"></script>
    <script src="Carousel/allinone_thumbnailsBanner.js"></script>
    <script src="Carousel/jquery.featureCarousel.js"></script>
    <script type="text/javascript">
        $(function () {
            function menu_cheak(selector, classname) {
                var $select = selector;
                $select.click(function () {
                    $(this).addClass(classname).siblings().removeClass(classname);

                })

            }
            menu_cheak($('.nav li'), 'active');
            menu_cheak($('.recipes .recipes_menu .menu_main dl dd a'), 'chosed');
            (function () {
                $('body').animate({ scrollTop: $('.navbar').offset().top }, 1000);
            })();//友好的页面显示，全局作用
            $('.info_til li').mouseenter(function () {
                var linkImage = $("#" + $(this).data("link-image"));
                linkImage.parent().find("li").removeClass("showit");
                linkImage.addClass("showit");
            });

            //$('.info_til li').mouseenter(
            //    function () {

            //        var $this = $(this);
            //        var til_index = $(this).data("index");
            //        $(".info_img li")
            //        $(".info_img li[data-index='" + til_index + "']").addClass("showit");

            //    }
            //);

            $.getJSON("Home/SelectImageSetting", function (config) {
                var folder;
                var $scr_wid = $(window).width();
                var banner_wid;
                var banner_hei;
                var screen_num;
                function hasFolder(set, folder) {
                    var image_setting = null;
                    $.each(set, function (i, elem) {
                        if (elem.folder == folder) {
                            image_setting = elem;
                            return false;
                        }
                    });
                    return image_setting;
                }
                $.each(config, function (i, item) {
                    //alert(config[i].name);
                    var images = config[i].ImageSettings;
                    //alert(images.folder);
                    //var img_fol = images.folder;
                    if (images != null && images.length != 0) {
                        var image_setting;
                        if ($scr_wid >= 1200 && (acc_min_width = "115px").length >= 0 && (image_setting = hasFolder(images, "wide")) !== null) {
                            folder = "wide";
                            acc_min_width = "115px";
                            banner_wid = image_setting.width;
                            banner_hei = image_setting.height;
                            screen_num = 7;
                            //feature_width = 450;
                            //feature_height = 230;

                        } else if ($scr_wid >= 768 && $scr_wid <= 979 && (image_setting = hasFolder(images, "pad")) !== null) {
                            folder = "pad";
                            acc_min_width = "30px";
                            banner_wid = image_setting.width;
                            banner_hei = image_setting.height;
                            screen_num = 5;
                            //feature_width = 340;
                            //feature_height = 174;


                        } else if ($scr_wid < 768 && (image_setting = hasFolder(images, "mobile")) !== null) {
                            folder = "mobile";
                            acc_min_width = "20px";
                            banner_wid = image_setting.width;
                            banner_hei = image_setting.height;
                            screen_num = 7;


                        } else {
                            image_setting = hasFolder(images, "default");
                            folder = "default";
                            acc_min_width = "70px";
                            banner_wid = image_setting.width;
                            banner_hei = image_setting.height;
                            screen_num = 7;
                            //feature_width = 450;
                            //feature_height = 230;
                        }
                        $('div[data-image-setting=' + config[i].alias + '] img').each(function (i, img) {
                            var $img = $(img);

                            var $slide_li = $img.parent();
                            var source = $img.data("source");
                            if (source) {
                                var data = "Upload/" + folder + "/" + source;
                                if (data) {
                                    $img.attr("data-src", data);
                                    $slide_li.attr("data-bottom-thumb", data);
                                }
                            }
                            $img.unveil();


                        });




                    }

                })

            });
        });

    </script>
}

<div class="container">
    <!-- title -->
    <div class="last_title visible-phone">
        <h3 class="span3 clearfix textline">
            <a href="#">[最新新闻]</a>
        </h3>
    </div>
    <div class="last_title hidden-phone">
        <div class="row">
            <h3 class="span2 offset2" style="line-height: 50px">关注</h3>
            <h1 class="span3">最新资讯</h1>
            <h3 class="span3" style="line-height: 50px">把握媒体新动向</h3>
        </div>
    </div>
    <hr class="featurette-divider" />
    <div class="row">
        <div class="span6 infomation profess ">
            <div class="row">
                <div class="span3" data-image-setting="Bulletin">
                    <ul class="info_img">

                        @for (int i = 0; i < Model.ProfessionBulletins.Count; i++)
                        {
                            var css = i == 0 ? "showit" : "";
                            var item = Model.ProfessionBulletins.ElementAt(i);
                            var itemLength = item.Summary.Length <= 15 ? item.Summary.Length : 15;
                            <li class="@css" id="@Html.Encode("pimage" + i)">
                               <a href="@Url.Action("readbulletin", new {id=item.Id })">
                                    <img src="lazyload/grey.gif" data-source="@item.ImagePath" />
                                </a>
                                <div class="mag_info1">
                                    <div class="mag_in_til">
                                        <h4>
                                            <a href="@Url.Action("readbulletin", new {id=item.Id })">@Html.Encode(item.Title)</a>
                                        </h4>
                                        <p>
                                            <span>@Html.Encode(item.Summary.Substring(0, itemLength) + "..")</span>

                                        </p>
                                    </div>

                                </div>
                            </li>
                            
                        }

                    </ul>
                </div>
                <div class="span3 info_til">
                    <ul>
                        @for (int i = 0; i < Model.ProfessionBulletins.Count; i++)
                        {
                            var item = Model.ProfessionBulletins.ElementAt(i);
                            <li data-link-image="@Html.Encode("pimage" + i)">
                                    <a href="@Url.Action("readbulletin", new {id=item.Id })">@Html.Encode(item.Title)
                                </a>
                            </li>
                        }

                    </ul>
                </div>
            </div>
        </div>
        <div class="span6 infomation cook ">
            <div class="row">
                <div class="span3 " data-image-setting="Bulletin">
                    <ul class="info_img">
                        @for (int i = 0; i < Model.CookBulletins.Count; i++)
                        {
                            var css = i == 0 ? "showit" : "";
                            var item = Model.CookBulletins.ElementAt(i);
                            var itemLength = item.Summary.Length <= 15 ? item.Summary.Length : 15;
                            <li class="@css" id="@Html.Encode("cimage" + i)">
                                <a href="@Url.Action("readbulletin", new {id=item.Id })">
                                    <img src="lazyload/grey.gif" data-source="@item.ImagePath" />
                                </a>
                                <div class="mag_info1">
                                    <div class="mag_in_til">
                                        <h4>
                                            <a href="#">@Html.Encode(item.Title)</a>
                                        </h4>
                                        <p>
                                            <span>@Html.Encode(item.Summary.Substring(0, itemLength) + "..")</span>

                                        </p>
                                    </div>

                                </div>
                            </li>
                            
                        }
                    </ul>
                </div>
                <div class="span3 info_til">
                    <ul>
                        @for (int i = 0; i < Model.CookBulletins.Count; i++)
                        {
                            var item = Model.CookBulletins.ElementAt(i);
                            <li data-link-image="@Html.Encode("cimage" + i)">
                               <a href="@Url.Action("readbulletin", new {id=item.Id })">@Html.Encode(item.Title)
                                </a>
                            </li>
                        }
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <div class="row recipes">
        <div data-image-setting="Bulletin">

            @for (int i = 0; i < Model.OtherBulletinList.Count; i++)
            {
                var item = Model.OtherBulletinList.ElementAt(i);
                var itemLength = item.Summary.Length <= 15 ? item.Summary.Length : 15;
                <div class="span3 list">
                    <div class="img">
                       <a href="@Url.Action("readbulletin", new {id=item.Id })">
                            <img src="lazyload/grey.gif" data-source="@item.ImagePath" /></a>
                    </div>
                    <div class="info2">
                    </div>
                    <div class="mag_info1">
                        <div class="mag_in_til">
                            <h4>
                               <a href="@Url.Action("readbulletin", new {id=item.Id })">@Html.Encode(item.Title)</a>
                            </h4>
                            <p>

                                <span>@Html.Encode(item.Summary.Substring(0, itemLength) + "..")</span>
                            </p>
                        </div>


                    </div>
                </div>
            }


        </div>

    </div>
    @Html.Partial("_PageBreak")
</div>
